@charset "utf-8";
@import 'normalize';
@import 'compass';
@import 'variables';
@import 'syntax';
@import 'icon-font';

/*
Copyright 2008-2013 Concur Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/

////////////////////////////////////////////////////////////////////////////////
// GENERAL STUFF
////////////////////////////////////////////////////////////////////////////////

html, body {
  color: $main-text;
  padding: 0;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  @extend %default-font;
  background-color: $main-bg;
}

////////////////////////////////////////////////////////////////////////////////
// TABLE OF CONTENTS
////////////////////////////////////////////////////////////////////////////////

.tocify-wrapper {
  overflow-y: auto;
  overflow-x: hidden;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: $nav-width;
  background-color: $nav-bg;
  font-size: 13px;
  font-weight: bold;

  // This is the logo at the top of the ToC
  &>img {
    display: block;
    margin-bottom: $logo-margin;
  }

  .tocify-item>a, .toc-footer li {
    padding: 0 $nav-padding 0 $nav-padding;
    display:block;
    overflow-x:hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  // The Table of Contents is composed of multiple nested
  // unordered lists.  These styles remove the default
  // styling of an unordered list because it is ugly.
  ul, li {
    list-style: none;
    margin: 0;
    padding: 0;
    line-height: 28px;
  }

  li {
    color: $nav-text;
    @include transition-property('background');
    @include transition-timing-function('linear');
    @include transition-duration(230ms);
  }

  // This is the currently selected ToC entry
  .tocify-focus {
    @include box-shadow(0px 1px 0px $nav-active-shadow);
    background-color: $nav-active-bg;
    color: $nav-active-text;
  }

  // Subheaders are the submenus that slide open
  // in the table of contents.
  .tocify-subheader {
    display: none; // tocify will override this when needed
    background-color: $nav-subitem-bg;
    font-weight: 500;
    @include background-image(
      linear-gradient(top,
                      darken($nav-subitem-bg,2%),
                      $nav-subitem-bg 10%,
                      $nav-subitem-bg 90%,
                      darken($nav-subitem-bg,2%))
    );
    .tocify-item>a {
      padding-left: $nav-padding + $nav-indent;
      font-size: 12px;
    }
    // These items make for a slight embossed look for the subheader.
    // "Why not put the borders in the subheader?" you ask.
    // "Because then the animation isn't as smooth," I reply.
    &>li:first-child {
      border-top: $nav-embossed-border-top;
    }
    &>li:last-child {
      border-bottom: $nav-embossed-border-bottom;
      box-shadow: none; // otherwise it'll overflow out of the subheader
    }
  }

  .toc-copyright {
    border-top: 1px dashed $nav-footer-border-color;
    padding: 1em $nav-padding 0 $nav-padding;
    color: $nav-text;
    font-size: 0.8em;
    line-height: 1.7;
    text-decoration: none;
  }

  .toc-footer {
    padding: 1em 0;
    margin-top: 1em;
    border-top: 1px dashed $nav-footer-border-color;

    li,a {
      color: $nav-text;
      text-decoration: none;
    }

    a:hover {
      text-decoration: underline;
    }

    li {
      font-size: 0.8em;
      line-height: 1.7;
      text-decoration: none;
    }
  }

}


////////////////////////////////////////////////////////////////////////////////
// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
////////////////////////////////////////////////////////////////////////////////

.page-wrapper {
  margin-left: $nav-width;
  min-width: 700px;
  position: relative;
  z-index: 10;
  background-color: $main-bg;

  padding-bottom: 1px; // prevent margin overflow

  // The dark box is what gives the code samples their dark background.
  // It sits essentially under the actual content block, which has a
  // transparent background.
  // I know, it's hackish, but it's the simplist way to make the left
  // half of the content always this background color.
  .dark-box {
    width: $examples-width;
    background-color: $examples-bg;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
  }

  #lang-selector {
    position: fixed;
    width: 100%;
    z-index: 50;
    font-weight: bold;
    background-color: $lang-select-bg;
    border-bottom: 5px solid $lang-select-active-bg;
    a {
      display: block;
      float:left;
      color: $lang-select-text;
      text-decoration: none;
      padding: 0 10px;
      line-height: 30px;

      &.active {
        background-color: $lang-select-active-bg;
        color: $lang-select-active-text;
      }

      &:active {
        background-color: $lang-select-pressed-bg;
        color: $lang-select-pressed-text;
      }
    }

    &:after {
      content: '';
      clear: both;
      display: block;
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// CONTENT STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff with the light background in the left half of the page

.content {
  // to place content above the dark box
  position: relative;
  z-index: 30;


  &>h1, &>h2, &>h3, &>p, &>table, &>ul, &>ol, &>aside, &>dl {
    margin-right: $examples-width;
    padding: 0 $main-padding;
    @include box-sizing(border-box);
    display: block;
    @include text-shadow($main-embossed-text-shadow);
  }

  &>ul, &>ol {
    padding-left: $main-padding + 15px;
  }

  // the div is the tocify hidden div for placeholding stuff
  &>h1, &>h2, &>div {
    clear:both;
  }

  h1 {
    @extend %header-font;
    font-size: 30px;
    padding-top: 0.5em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #ccc;
    margin-top: 2em;
    margin-bottom: $h1-margin-bottom;
    border-top: 1px solid #ddd;
    @include background-image(
      linear-gradient(top, #fff, #f9f9f9)
    );
  }

  // The header at the very top of the page
  // shouldn't have top margin.
  // (the div is because of tocify)
  h1:first-child, div:first-child + h1 {
    margin-top: 0;
  }

  h2 {
    @extend %header-font;
    font-size: 20px;
    margin-top: 4em;
    margin-bottom: 0;
    border-top: 1px solid #ccc;
    padding-top: 1.2em;
    padding-bottom: 1.2em;
    @include background-image(
      linear-gradient(top, rgba(#fff,0.4), rgba(#fff, 0))
    );
  }

  // h2s right after h1s should bump right up
  // against the h1s.
  h1 + h2, h1 + div + h2 {
    margin-top: $h1-margin-bottom * -1;
    border-top: none;
  }

  h3 {
    @extend %header-font;
    font-size: 12px;
    margin-top: 2.5em;
    margin-bottom: 0.8em;
    text-transform: uppercase;
  }

  hr {
    margin: 2em 0;
    border-top: 2px solid $examples-bg;
    border-bottom: 2px solid $main-bg;
  }

  table {
    margin-bottom: 1em;
    overflow: auto;
    th,td {
      text-align: left;
      vertical-align: top;
      line-height: 1.6;
    }

    th {
      padding: 5px 10px;
      border-bottom: 1px solid #ccc;
      vertical-align: bottom;
    }

    td {
      padding: 10px;
    }

    tr:last-child {
      border-bottom: 1px solid #ccc;
    }

    tr:nth-child(odd)>td {
      background-color: lighten($main-bg,4.2%);
    }

    tr:nth-child(even)>td {
      background-color: lighten($main-bg,2.4%);
    }
  }

  dt {
    font-weight: bold;
  }

  dd {
    margin-left: 15px;
  }

  p, li, dt, dd {
    line-height: 1.6;
    margin-top: 0;
  }

  img {
    max-width: 100%;
  }

  code {
    background-color: rgba(0,0,0,0.05);
    padding: 3px;
    border-radius: 3px;
    @extend %break-words;
    @extend %code-font;
  }

  aside {
    padding-top: 1em;
    padding-bottom: 1em;
    text-shadow: 0 1px 0 lighten($aside-notice-bg, 15%);
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    background: $aside-notice-bg;
    line-height: 1.6;

    &.warning {
      background-color: $aside-warning-bg;
      text-shadow: 0 1px 0 lighten($aside-warning-bg, 15%);
    }

    &.success {
      background-color: $aside-success-bg;
      text-shadow: 0 1px 0 lighten($aside-success-bg, 15%);
    }
  }


  aside.warning {
  }

  aside:before {
    vertical-align: middle;
    padding-right: 0.5em;
    font-size: 14px;
  }

  aside.notice:before {
    @extend %icon-info-sign;
  }

  aside.warning:before {
    @extend %icon-exclamation-sign;
  }

  aside.success:before {
    @extend %icon-ok-sign;
  }

}


////////////////////////////////////////////////////////////////////////////////
// CODE SAMPLE STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff that appears in the right half of the page

.content {
  pre, blockquote {
    background-color: $code-bg;
    color: #fff;

    padding: 2em $main-padding;
    margin: 0;
    width: $examples-width;

    float:right;
    clear:right;

    @include box-sizing(border-box);
    @include text-shadow(0px 1px 2px rgba(0,0,0,0.4));

    &>p { margin: 0; }

    a {
      color: #fff;
      text-decoration: none;
      border-bottom: dashed 1px #ccc;
    }
  }

  pre {
    @extend %code-font;
  }

  blockquote {
    &>p {
      background-color: $code-annotation-bg;
      border-radius: 5px;
      padding: $code-annotation-padding;
      color: #ccc;
      border-top: 1px solid #000;
      border-bottom: 1px solid #404040;
    }
  }
}